

import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/minstallement")
public class minstallement extends HttpServlet {
	private static final long serialVersionUID = 1L;
    public minstallement() throws ClassNotFoundException {
        super();
        Class.forName ("org.sqlite.JDBC");

    }
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			Connection conn = DriverManager.getConnection("jdbc:sqlite:cms.db");
			String roll=request.getParameter("roll");
			PreparedStatement preStatement = conn.prepareStatement("update fee set installement=\'2\' , payable = ? ,due= ? , req =\'0\' where roll= ?;");
			String payable=request.getParameter("inst1");
			String due=request.getParameter("due1");
			preStatement.setString(1,payable);
			preStatement.setString(2,due);
			preStatement.setString(3,roll);
			preStatement.executeUpdate();
			String s="<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><meta http-equiv=\"refresh\" content=\"1; url=minstallement.jsp\"> </head><body ><h1>replied to request</h1></body></html>";
		    response.getWriter().println(s);
		    preStatement.close();
			conn.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}

	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	}

}
